//
//  SocialShare.m
//  YRSideViewController
//
//  Created by xiabin on 15/6/2.
//  Copyright (c) 2015年 YueRuo. All rights reserved.
//

#import "SocialShare.h"
/*
#import "WXApi.h"
#import "WXApiObject.h"
#import "SDWebImageManager.h"
#import <TencentOpenAPI/QQApiInterface.h>
#import <TencentOpenAPI/QQApiInterfaceObject.h>

@implementation SocialShare

+(BOOL) WechatShareHelp:(NSString*) title Content:(NSString*) content URL:(NSString*) url Image:(NSString*)imageUrl Type:(int) bFriend
{
    if ([WXApi isWXAppInstalled] && [WXApi isWXAppSupportApi])
    {
        SDWebImageManager *manager = [SDWebImageManager sharedManager];
        [manager downloadImageWithURL:[NSURL URLWithString:imageUrl]
                             options:0
                            progress:^(NSInteger receivedSize, NSInteger expectedSize){}
                           completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {
                               if (image)
                               {
                                   UIImage* thumbnail = [Utils thumbnailWithImageWithoutScale:image size:CGSizeMake(90, 90)];
                                   WXMediaMessage *message = [WXMediaMessage message];
                                   [message setThumbImage:thumbnail];
                                   message.title = title;
                                   message.description = content;
                                   WXAppExtendObject *ext1 =[WXAppExtendObject object];
                                   ext1.url= url;
                                   message.mediaObject=ext1;
                                   enum WXScene _scene = bFriend;
                                   
                                   SendMessageToWXReq* req = [[SendMessageToWXReq alloc] init];
                                   req.bText = NO;
                                   req.message = message;
                                   req.scene = _scene;
                                   NSLog(@"=====%d",req.scene);
                                   [WXApi sendReq:req];
                               }

                           }];
    }
    else
    {
        [Utils TTAlertNoTitle:@"你还没有安装微信,无法使用此功能。"];
    }
    return TRUE;
}

+(BOOL) shareToWeChatFriendsTitle:(NSString*) title Content:(NSString*) content URL:(NSString*) url Image:(NSString*) imageUrl
{
    return  [SocialShare WechatShareHelp:title Content:content URL:url Image:imageUrl Type:1];
}

+(BOOL) shareToWeChatwithTitle:(NSString*) title Content:(NSString*) content URL:(NSString*) url Image:(NSString*) imageUrl
{
    return  [SocialShare WechatShareHelp:title Content:content URL:url Image:imageUrl Type:0];
}

+(BOOL) shareToQQwithTitle:(NSString*) title Content:(NSString*) content URL:(NSString*) url Image:(NSString*) imageUrl
{
    if ([QQApiInterface isQQInstalled]) {
        NSURL* _imgUrl = [NSURL URLWithString:imageUrl];
        NSURL* _url = [NSURL URLWithString:url];
    
        QQApiNewsObject* img = [QQApiNewsObject objectWithURL:_url title:title description:content previewImageURL:_imgUrl];
        SendMessageToQQReq* req = [SendMessageToQQReq reqWithContent:img];
    
        [QQApiInterface sendReq:req];
    } else {
        [Utils TTAlertNoTitle:@"你还没有手机QQ,无法使用此功能。"];
    }
    return TRUE;
}

+(BOOL) shareToQZonewithTitle:(NSString*) title Content:(NSString*) content URL:(NSString*) url Image:(NSString*) imageUrl
{
    if ([QQApiInterface isQQInstalled]) {
        NSURL* _imgUrl = [NSURL URLWithString:imageUrl];
        NSURL* _url = [NSURL URLWithString:url];

        QQApiNewsObject* img = [QQApiNewsObject objectWithURL:_url title:title description:content previewImageURL:_imgUrl];
        [img setCflag:kQQAPICtrlFlagQZoneShareOnStart];
        SendMessageToQQReq* req = [SendMessageToQQReq reqWithContent:img];
    
        [QQApiInterface sendReq:req];
    } else {
        [Utils TTAlertNoTitle:@"你还没有手机QQ,无法使用此功能。"];
    }
    return TRUE;
}
@end*/
